import request from "@/utils/request";

// 订单列表
export function getOrderList(params, page = 1, pageSize = 10) {
  return request({
    url: `/order/list?pageNo=${page}&pageSize=${pageSize}`,
    method: "post",
    data: params,
  });
}

// 创建订单
export function createOrder(data) {
  return request({
    url: "/order/pcSaveUpdate",
    method: "post",
    data,
  });
}

// 订单详情
export function getOrderDetail(id) {
  return request({
    url: `/order/getOrderDetail?orderId=${id}`,
    method: "get",
  });
}

// 符合查询订单详情页
export function getOrderDetailByMulType(searchInfo) {
  return request({
    url: `/order/getOrderDetailUesMulType?searchInfo=${searchInfo}`,
    method: "get",
  });
}

// 订单出库
export function orderOutStorage(ids) {
  return request({
    url: `/order/pcStockOut?orderIds=${ids}`,
  });
}

// 线上订单出库
export function orderOutStorageOnline(data) {
  return request({
    url: `/order/onlineStockOut`,
    method: "post",
    data,
  });
}

// 鞋子入库
export function shoeInStorage(data) {
  return request({
    url: "/order/orderIn",
    method: "post",
    data,
  });
}

// 通过订单号获取订单详情
export function getOrderByOrderNo(orderNo) {
  return request({
    url: `/order/getOrderDetailByNo?orderNo=${orderNo}`,
    method: "get",
  });
}

// 修改鞋子类型
export function updateShoeType(data) {
  return request({
    url: "/shoe/updateShoeWashType",
    method: "post",
    data,
  });
}

// 订单统计
export function getOrderStatistics() {
  return request({
    url: "/order/orderCount",
    method: "post",
  });
}

// 入库记录
export function getInStorageLogList(params, page = 1, pageSize = 10) {
  return request({
    url: `/order/checkInList?pageNo=${page}&pageSize=${pageSize}`,
    method: "post",
    data: params,
  });
}

// 出库记录
export function getOutStorageLogList(params, page = 1, pageSize = 10) {
  return request({
    url: `/order/checkOutList?pageNo=${page}&pageSize=${pageSize}`,
    method: "post",
    data: params,
  });
}

// 取消订单
export function cancelOrder(orderId) {
  return request({
    url: `/order/cancelOrder?orderId=${orderId}`,
    method: "post",
  });
}

// 取消小程序订单
export function cancelOrderByMini(orderId) {
  return request({
    url: `/order/cancelXcx?orderId=${orderId}`,
    method: "post",
  });
}

// 分配鞋架
export function orderAssignShoeRack(orderId, shoesNum, shopId) {
  return request({
    url: `/order/shareGrid?orderId=${orderId}&shoesNum=${shoesNum}&shopId=${shopId}`,
  });
}

// 订单增加鞋子
export function addShoeToOrder(orderId, shoesNum) {
  return request({
    url: `/order/shareGridAddShoe?orderId=${orderId}&shoesNum=${shoesNum}`,
  });
}

// 返洗订单
export function orderReturnWash(data) {
  return request({
    url: `/order/returnWashOrder`,
    method: "post",
    data,
  });
}

// 取消美团订单
export function cancelMeituanOrder(orderId) {
  return request({
    url: `/merchantCancelOrder/cancelOrderByOrderId?orderId=${orderId}`,
  });
}

// 今日入库订单统计
export function getTodayInStorageStatistics() {
  return request({
    url: "/orderStatis/todayCheckInNum",
    method: "post",
  });
}

// 核销记录
export function getVerificationLogList(params, page = 1, pageSize = 10) {
  return request({
    url: `/checkHistory/list?pageNo=${page}&pageSize=${pageSize}`,
    method: "post",
    data: params,
  });
}



/**
 * 更新备注
 */
export function updateOrderShopRemark(orderId, shopRemark) {
  return request({
    url: `/order/updateRemark?orderId=${orderId}&shopRemark=${shopRemark}`,
  });
}

/**
 *
 * 美团订单完成
 */
export function meituanOrderFinish(orderId) {
  return request({
    url: `/order/fulFillMtStatus?orderId=${orderId}`,
  });
}

/**
 * 抖音退款列表
 */
export function getDouyinRefundList(data, page = 1, pageSize = 10) {
  return request({
    url: `/refund/list?pageNo=${page}&pageSize=${pageSize}`,
    method: "post",
    data: data,
  });
}


// 临时修复订单接口
export function correct(data) {
  return request({
    url: `/order/correct`,
    method: "post",
    data: data,
  });
}

// 获取水洗码
export function getWashCode(data) {
  return request({
    url: `/order/getWashCode`,
    method: "post",
    data: data,
  });
}

// 创建单个商品
export function orderInNew(data){
 return request({
    url: `/order/orderIn/new`,
    method: "post",
    data: data
  });
}

// 移除商品
export function removeShoe(data){
 return request({
    url: `/order/removeShoe`,
    method: "post",
    data: data
  });
}

//获取统计
export function orderStatis(data){
 return request({
    url: `/order/orderStatis`,
    method: "get",
    params: data
  });
}


//确认入库
export function confimInStorage(data){
 return request({
    url: `/order/orderIn/confim`,
    method: "post",
    data: data
  });
}


export function qualityInspectByWashCode(data){
 return request({
    url: `/qualityInspection/qualityInspectByWashCode`,
    method: "post",
    data: data
  });
}

export function offerRefund(params){

  return request({
    url: `/refund/offerRefund`,
    method: "post",
    params: params,
  });
}

export function checkRefundApi(orderNo) {
  return request({
    url: `/firstPage/queryRefund?orderNo=${orderNo}`,
    method: "get",
  });
}

export function bindRackGridPo(orderId){
      return request({
          url: `/order/bindRackGridPo?orderId=${orderId}`,
          method: "get",
        });
}

